package com.sky.mapper;

import com.sky.aop.AutoFill;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    /**
     * 添加套餐与菜品关系
     * @param setmealDish 套餐与菜品信息
     */
    @AutoFill(OperationType.INSERT)
    void insertDishSetmeal(@Param("setmealDish") List<SetmealDish> setmealDish);

    /**
     * 删除套餐与菜品关系
     * @param ids 套餐ID
     */
    void deleteSetmealDish(@Param("ids") List<Long> ids);

    /**
     * 查询套餐菜品关系
     * @param id 套餐ID
     * @return 套餐菜品关系
     */
    @Select("select id,setmeal_id,dish_id,name,price,copies from setmeal_dish where setmeal_id=#{id}")
    List<SetmealDish> selectByIdSetmealDish(Long id);

    /**
     * 基于ID删除套餐菜品关联信息
     * @param id
     */
    void deleteSetmeal(Long id);
}
